package com.tc168.cp306.b06.fragment;


import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.tc168.cp306.b06.R;
import com.tc168.cp306.b06.Utils.ToastUtil;
import com.tc168.cp306.b06.adaptre.BijiAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * A simple {@link Fragment} subclass.
 */
public class NoteFragment extends Fragment {


    @BindView(R.id.aaa)
    RecyclerView aaa;
    Unbinder unbinder;
    private BijiAdapter bijiAdapter;

    public NoteFragment() {
        // Required empty public constructor
    }

    private List<String> aa;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_note, container, false);
        unbinder = ButterKnife.bind(this, view);
        return view;
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        aa = new ArrayList<>();
        aa.add("添加笔记");
        bijiAdapter = new BijiAdapter(getActivity(), aa);

        aaa.setLayoutManager(new GridLayoutManager(getActivity(), 2));
        aaa.setAdapter(bijiAdapter);

        bijiAdapter.setOnItemClickListener(new BijiAdapter.MyItemClickListener() {
            @Override
            public void onItemClick(View view, int postion) {

                if (aa.size() - 1 == postion) {

                    ToastUtil.showLong(getActivity(),"必须用满1天才可以添加笔记");
                } else {



                }
            }
        });
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }
}
